package cn.crce.cloud9.simple;

/**
 * @author OnCloud9
 * @description
 * @project NRCE-TEST
 * @date 2022年09月10日 上午 11:35
 */
public class Case45 {

    public static void main(String[] args) {
        Figure[] fig = new Figure[3];
        fig[0] = new Circle(1.0);
        fig[1] = new Circle(2.0);
        //**********Found**********
        fig[2] = new Rectangle(2.0, 3.0);
        ;
        for (int i = 0; i < 3; i++)
            //**********Found**********
            System.out.println("The area of figure " + i + " is:" + fig[i].area());
    }

}

abstract class Figure {
    //**********Found**********
    public abstract double area();
}

class Circle extends Figure {
    double r;

    Circle(double r) {
        this.r = r;
    }

    public double area() {
        //**********Found**********
        return Math.PI * r;
    }
}

class Rectangle extends Figure {
    double a, b;

    Rectangle(double a, double b) {
        this.a = a;
        this.b = b;
    }

    public double area() {
        //**********Found**********
        return a * b;
    }
}